package chapter04

import scala.collection.parallel.CollectionConverters.ImmutableIterableIsParallelizable
import scala.collection.parallel.immutable.ParIterable

/**
 * @program lu-scala01
 * @description:  并行计算
 * @author: zhanglu
 * @create: 2022-04-09 17:16:00
 */
object Lu18_Parallel {

  def main(args: Array[String]): Unit = {
    val res: IndexedSeq[String] = (1 to 5).map(x => Thread.currentThread().getName + Thread.currentThread().getId)
    println(res)

    val res2: ParIterable[String] = (1 to 5).par.map(x => Thread.currentThread().getName + Thread.currentThread().getId)
    println(res2)


  }

}
